﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Business.Partner;
using PJ.Framework.Common;
using PJ.Data.SalePurchase.Sale;
using PJ.Business.Inventory;

namespace PJ.Business.SalePurchase.Sale
{
    /// <summary>
    /// CustomerShoppingCartItemService class
    /// </summary>
    public class CustomerShoppingCartItemService : ShoppingCartItemService<ICustomerShoppingCartItem, ICustomerShoppingCartItemData, ICustomerShoppingCartItemProvider>, ICustomerShoppingCartItemService
    {
        #region Constructor

        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="dataService">Data provider</param>
        public CustomerShoppingCartItemService(ICustomerShoppingCartItemProvider dataService)
            : base(dataService)
        {
        }

        #endregion
        #region Interface implementation
        public ICustomerShoppingCartService CustomerShoppingCartService
        {
            get
            {
                if (_CustomerShoppingCartService == null)
                    _CustomerShoppingCartService = InjectionBroker.Resolve<ICustomerShoppingCartService>();
                return _CustomerShoppingCartService;
            }
        }
        public IInventoryItemSalesParamService InventoryItemSalesParamService
        {
            get
            {
                if (_InventoryItemSalesParamService == null)
                    _InventoryItemSalesParamService = InjectionBroker.Resolve<IInventoryItemSalesParamService>();
                return _InventoryItemSalesParamService;
            }
        }
        #endregion
        #region Interface override
        public override IShoppingCartService ShoppingCartService
        {
            get { return CustomerShoppingCartService; }
        }
        public override IInventoryItemOrderParamService InventoryItemOrderParamService
        {
            get { return InventoryItemSalesParamService; }
        }
        #endregion

        #region Public
        public override ICustomerShoppingCartItem CreateNewItem()
        {
            return new CustomerShoppingCartItem(DataService.CreateNewItem());
        }
        #endregion
        #region Field
        
        private ICustomerShoppingCartService _CustomerShoppingCartService;
        private IInventoryItemSalesParamService _InventoryItemSalesParamService;
        
        #endregion

    }
}
